package com.igd.utils.dev.dbmapper.impl;

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

import com.igd.utils.dev.dbmapper.IDbMapper;

/**
 * @version 1.0
 * 
 * @author QIAOYU
 * 
 * @date 2013-7-8
 * 
 * @description 数据库字段类型映射成Java数据类型实现抽象类
 */

public abstract class AbstractMapper implements IDbMapper {

	private static Map<Integer, String> dbMapper = new HashMap<Integer, String>();

	static {

		dbMapper.put(Types.BIGINT, "long");

		dbMapper.put(Types.BIT, "boolean");

		dbMapper.put(Types.BLOB, "byte[]");

		dbMapper.put(Types.CHAR, "String");

		dbMapper.put(Types.CLOB, "String");

		dbMapper.put(Types.DATE, "Date");

		dbMapper.put(Types.DECIMAL, "BigDecimal");

		dbMapper.put(Types.DOUBLE, "Double");

		dbMapper.put(Types.FLOAT, "float");

		dbMapper.put(Types.INTEGER, "int");

		dbMapper.put(Types.JAVA_OBJECT, "Object");

		dbMapper.put(Types.NUMERIC, "BigDecimal");

		dbMapper.put(Types.OTHER, "Object");

		dbMapper.put(Types.REAL, "float");

		dbMapper.put(Types.SMALLINT, "int");

		dbMapper.put(Types.TIME, "Time");

		dbMapper.put(Types.TINYINT, "Bute");

		dbMapper.put(Types.VARCHAR, "String");
	}

	/**
	 * 设置每个数据库自己特有的字段映射
	 */
	protected void setPeculiar() {

	};
	
	public Map<Integer, String> getDbMapper(){
		
		return this.dbMapper;

	}
}
